# !/usr/bin/env python
# encoding: utf-8


"""
  @author: gaogao
  @file: singleton_util.py
  @time: 2022/7/22 8:53
  @desc:
"""


def singleton(cls, *args, **kwargs):
    instances = {}

    def _singleton(*args, **kwargs):
        if cls not in instances:
            instances[cls] = cls(*args, **kwargs)
        return instances[cls]

    return _singleton
